package com.edu.marker;

import android.app.Application;
import android.content.Context;

import com.edu.marker.cache.EImageConfigs;
import com.edu.marker.cache.EImageView;
import com.edu.marker.http.EHttpClient;
import com.edu.marker.http.EHttpConfigs;

public class MarkerApp extends Application {
	@Override
	public void onCreate() {
		super.onCreate();
		initMarker(getApplicationContext());
	}

	private void initMarker(Context context) {
		final EHttpConfigs httpConfig = new EHttpConfigs.Builder(context)
				.setGZIPEnable(true).setBufferSize(4096).setMaxConns(100)
				.setSoTimeout(40 * 1000).build();
		EHttpClient.getInstance().init(httpConfig);

		final EImageConfigs imageConfig = new EImageConfigs.Builder(context)
				.setDiskCacheEnabled(true).setMaxMemoryCacheSize(8 << 20)
				.setDiskCacheMaxSize(10 << 20)
				.setHttpClient(EHttpClient.getInstance().getHttpClient())
				.build();
		EImageView.init(imageConfig);

	}
}
